#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
int a[N];
int n;
map<int, int>mp;
int main()
{	
	int t;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		mp.clear();
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int x;
			scanf("%d", &x);
			for (int j = 1; j <= n / x; j++) {
				mp[j * x]++;
				//cout << "j==" << j << endl;
				ans = max(ans, mp[j * x]);
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}